package com.miracle9.game.dao;
import com.miracle9.game.entity.ActivityInfo;
import org.hibernate.Query;
import org.springframework.stereotype.Repository;

@Repository
public class ActivityInfoServiceDao extends SqlOperating<ActivityInfo, Integer>
{
  public ActivityInfo getActivityInfo()
  {
    return (ActivityInfo)q_CreateSqlFilter("from ActivityInfo", new Object[0]);
  }
  
  public void save(ActivityInfo activityInfo)
  {
    update(activityInfo);
  }
  
  public boolean updateActivityStatus(int activityState)
  {
    Query query = q_CreateSql(
      "update ActivityInfo set activityStatus = ? ", new Object[] { Integer.valueOf(activityState) });
    int count = query.executeUpdate();
    return count > 0;
  }
}
